﻿$(function () {
    var partyId = getParam("partyid");
    loadTables(partyId);
});


//获取当前部门所有民警
function loadTables(partyId) {
    if (partyId == 0) return;
    $("#tableBody").html("");
    $.ajax({
        type: "Get",
        url: "/Party/GetPartyMemberByPartyId?partyId=" + partyId,
        success: function (data) {
            $.each(data, function (i, item) {
                var tr = "<div class='weui-cell'>" +
                    "<div class='weui-cell__hd' style='position: relative;margin-right: 10px;'>" +
                        "<img src='/images/dq.jpg' style='width: 50px;display: block'>  " +
                    "</div>" +
                    "<div class='weui-cell__bd'>" +
                        "<p>" + item.name + "<span style='font-size: 13px;color: #888888;'>&nbsp;&nbsp;&nbsp;&nbsp;联系电话：<a href='tel:139xxxxxxxx'>" + item.tel + "</a></span></p>" +
                        "<p style='font-size: 13px;color: #888888;'>&nbsp;&nbsp;职位：" + item.position + "</p>" +
                        "<p style='font-size: 13px;color: #888888;'>&nbsp;&nbsp;理念：" + item.remarks + "</p>" +
                    "</div>" +
                "</div>";
                $("#tableBody").append(tr);
            })
        }
    });
};

//获取URL上的参数
function getParam(paramName) {
    paramValue = "";
    isFound = false;
    if (this.location.search.indexOf("?") == 0 && this.location.search.indexOf("=") > 1) {
        arrSource = unescape(this.location.search).substring(1, this.location.search.length).split("&");
        i = 0;
        while (i < arrSource.length && !isFound) {
            if (arrSource[i].indexOf("=") > 0) {
                if (arrSource[i].split("=")[0].toLowerCase() == paramName.toLowerCase()) {
                    paramValue = arrSource[i].split("=")[1];
                    isFound = true;
                }
            }
            i++;
        }
    }
    return paramValue;
}